package hos.demo

import android.app.ProgressDialog
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import hos.base.LoadingDialog
import hos.thread.hander.MH

class MainActivity : AppCompatActivity() {

    private var mProgressDialog: LoadingDialog? = null

    protected fun getProgressDialog(): LoadingDialog {
        if (mProgressDialog == null) {
            mProgressDialog = LoadingDialog(ProgressDialog(this))
        }
        return mProgressDialog!!
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val target = this.javaClass

        val application = target.getMethod("getApplication").invoke(this)
        Log.i("MainActivity", "onCreate: $application")
        getProgressDialog().loadingStyle(false)
        getProgressDialog().showLoading()
        MH.postDelayed({
            getProgressDialog().hideLoading()
        }, 3000)
    }
}